#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n,q,s;
int f,v;
struct node{
	long long int x;
	long long int y;
}a[8100];
struct edge{
	long long int x;
	long long int y;
}b[8100];
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin>>n>>q;
	for(int i=1;i<=n;i++){
		cin>>a[i].x;
		a[i].y=i;
	}
	for(int i=1;i<=q;i++){
		cin>>s;
		for(int i=1;i<=n;i++){
			b[i].x=a[i].x;
			b[i].y=a[i].y;	
		}
		if(s==1){
			cin>>f>>v;
			a[f].x=b[f].x=v;
		}else{
			cin>>f;
			for (int i=1;i<=n;i++)
 				for (int j =i;j>=2; j--)
 					if (b[j].x<b[j-1].x){
 						int t=b[j-1].x;
 						b[j-1].x=b[j].x;
 						b[j].x=t; 
 						if(f==b[j].y) f=b[j-1].y;
 						else if(f==b[j-1].y) f=b[j].y;
					}
			cout<<f<<endl;
		}
	}	
	fclose(stdin);
	fclose(stdout);
	return 0;
}
